<template>
  <div class="home">
    <el-container>
      <el-header style="height:40px">
        <ul class="ul1">
          <li>
            <span class="li1">登陆</span>
            <span class="li1">|</span>
            <span class="li1">注册</span>
          </li>
          <li>
            <span>我的订单</span>
          </li>
          <li>
            <span>我的收藏</span>
          </li>
          <li>
            <span>
              购物车
              <span>(0)</span>
            </span>
          </li>
        </ul>
      </el-header>
      <div class="div5">
        <div class="div1">
          <img src="../assets/logo.png" alt />
        </div>
        <el-menu class="el-menu-demo" mode="horizontal" router>
          <el-menu-item index="/shouye">首页</el-menu-item>
          <el-menu-item index="/quanbu">全部商品</el-menu-item>
          <el-menu-item index="/guanyu">关于我们</el-menu-item>
        </el-menu>
        <div>
          <el-input placeholder="请输入内容" class="input-with-select">
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </div>
      </div>
      <hr />
      <el-main>
        <el-carousel indicator-position="outside" height="460px">
          <el-carousel-item v-for="item in scarousel" :key="item.scarousel_id">
            <img :src="'api/'+item.imgPath" alt />
          </el-carousel-item>
        </el-carousel>
      </el-main>

      <el-footer>
        <ul class="ul3">
          <li>
            <span class="span2"></span>
            <span>7天无理由退换货</span>
          </li>
          <li>
            <span class="span2"></span>
            <span>满99元全场免邮</span>
          </li>
          <li>
            <span class="span2"></span>
            <span>100%品质保证</span>
          </li>
        </ul>
        <div class="div6">
          <img src="../assets/github.png" alt />
        </div>
        <div class="div7">
          <ul class="ul4">
            <li>首页</li>
            <li>|</li>
            <li>全部商品</li>
            <li>|</li>
            <li>关于我们</li>
          </ul>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import Api from "../api/homeApi";
export default {
  data() {
    return {
      scarousel: {}
    };
  },
  created() {
    this.getScarousels();
  },
  methods: {
    async getScarousels() {
      let res = await Api.getCarousel();
      this.scarousel = res.carousel;
      console.log(this.scarousel);
    }
  }
};
</script>
<style lang="scss" scoped>
.home {
  width: 100%;
}
.el-footer {
  padding: 0;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #2f2f2f;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}
.el-header {
  line-height: 53px;
  background: #3d3d3d;
  color: #b0b0b0;
}
.el-main {
  height: 100%;
  width: 90%;
  margin: auto;
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  padding: 0;
  // line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.ul1 {
  display: flex;
  justify-content: flex-end;
  height: 35px;
  line-height: 35px;
  li {
    display: flex;
    .li1 {
      margin-right: 5px;
    }
    span {
      margin-right: 20px;
    }
  }
  li span:hover {
    color: white;
  }
}
.div1 {
  width: 189px;
  height: 59px;
  img {
    width: 100%;
    height: 100%;
  }
}

.div5 {
  display: flex;
  align-items: center;
  width: 90%;
  margin-top: 10px;
  margin: 0 auto;
  justify-content: space-between;
}
.div2 {
  margin-left: 276px;
  margin-top: 10px;
}
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  margin: 0;
}
.el-carousel__container {
  height: 460px;
  img {
    width: 100%;
    height: 100%;
  }
}
.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}
.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
.ul3 {
  width: 100%;
  height: 145px;
  display: flex;
  background: #2f2f2f;
  justify-content: space-between;

  li {
    display: flex;
    width: 33%;
    height: 145px;
    align-items: center;
    justify-content: center;
    span {
      color: white;
      font-weight: bold;
    }
    .span2 {
      background-image: url("../assets/us-icon.png");
      width: 39px;
      height: 42px;
      background-repeat: no-repeat;
    }
  }
}
.div6 {
  width: 100%;
  height: 50px;
  background: #2f2f2f;
  align-items: center;
  img {
    width: 50px;
    height: 100%;
  }
}

.div7 {
  width: 100%;
  background: #2f2f2f;
  .ul4 {
    display: flex;
    width: 220px;
    height: 21px;
    margin: auto;
    align-items: center;
    justify-content: space-around;
    li {
      display: flex;
      
    }
  }
}
</style>
